/*
 * Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
 * 
 * Copyright 2009 by Sebastián Zaffarano
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 */
package org.sigedu.core.components;

import java.util.LinkedList;
import java.util.List;

import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.sigedu.utils.Item;

/**
 * @author sebas
 * 
 * @version $Id: Layout.java 47 2009-02-20 16:15:48Z hermetica $
 */
@IncludeStylesheet("layout.css")
public class Layout {
	public List<Item> getItems() {
		List<Item> root = new LinkedList<Item>();
		root.addAll(get("Archivo", "Escuela", "Alumnos", "Configuracion"));
		root.get(0).getChilds().addAll(get("Imprimir", "Guardar", "Salir"));
		root.get(1).getChilds().addAll(get("Docentes", "Aulas"));
		root.get(1).getChilds().get(1).getChilds().addAll(get("Agregar"));
		return root;
	}
	
	private List<Item> get(final String... items) {
		List<Item> list = new LinkedList<Item>();
		for (String s : items) {
			list.add(new Item(s, s));

		}
		return list;
	}
	
	void onSelectItemFromMenu(final Item item) {
		System.out.println("Se clickeo: " + item.getName());
	}
}
